#!/bin/bash

start=`date +%s` # %s可以计算的是1970年以来的秒数

cd ../build

#TODO:少一个fb_200M
if [ $1 == "1" ]
then dist=books_200M
elif [ $1 == '2' ];
then dist=lognormal_200M
elif [ $1 == '3' ]
then dist=normal_200M
elif [ $1 == '4' ]
then dist=uniform_dense_200M
elif [ $1 == '5' ]
then dist=uniform_sparse_200M
fi

./read_cold -f ../db/dataset/${dist}.txt -k 16 -v 64 -d ../ssd/db_${dist} -m 7 -w > ../evaluation/${dist}_put.txt
./read_cold -f ../db/dataset/${dist}.txt -k 16 -v 64 -d ../ssd/db_${dist} -m 7 -u -n 10000 -i 5 --change_level_load $* > ../evaluation/${dist}_llsm.txt
./read_cold -f ../db/dataset/${dist}.txt -k 16 -v 64 -d ../ssd/db_${dist} -m 8 -u -n 10000 -i 5 $* > ../evaluation/${dist}_baseline.txt

cd ../learned-leveldb/
python ./scripts/collect_sosd_single.py ${dist} > ../evaluation/expr_${dist}.txt
cat ../evaluation/expr_${dist}.txt

end=`date +%s`

time=`echo $start $end | awk '{print $2-$1}'`
echo ${dist} time_elapse $time
